package main

import (
	"com.cyt.common/library/queue"
	"com.cyt.common/cmd/jobs/task"
	"fmt"
	"os"
	"os/signal"
	_ "com.cyt.common/boot"
)

func main() {
	engine := queue.Client()
	engine.Queue(task.QUEUE_EXPLAME).HandleFunc(task.ExampleHandle)

	c := make(chan os.Signal, 1)
	signal.Notify(c, os.Interrupt)

	go func() {
		for range c {
			fmt.Println("Received signal, gracefully stopping")
			//log.Print("Received signal, gracefully stopping")
			engine.Stop(queue.Ctx)
		}
	}()

	engine.Run(queue.Ctx)
}